package com.example.demo.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;
import javax.transaction.Transactional;

import org.springframework.format.annotation.DateTimeFormat;

import com.example.demo.custom.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

@Entity
public class YanBao2 {
	private Integer id;
	private YanBao yanBao;//延保名字
	private Float yanBaoPrice;//延保价格
	private Float yanBaoCost;//延保成本
	private Date beginDate;//起始日期
	private Date endDate;//结束日期
	@ManyToOne
	public YanBao getYanBao() {
		return yanBao;
	}
	public void setYanBao(YanBao yanBao) {
		this.yanBao = yanBao;
	}
	
	
	public Float getYanBaoPrice() {
		return yanBaoPrice;
	}

	public void setYanBaoPrice(Float yanBaoPrice) {
		this.yanBaoPrice = yanBaoPrice;
	}
	public Float getYanBaoCost() {
		return yanBaoCost;
	}
	public void setYanBaoCost(Float yanBaoCost) {
		this.yanBaoCost = yanBaoCost;
	}
	

	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getBeginDate() {
		return beginDate;
	}
	public void setBeginDate(Date beginDate) {
		this.beginDate = beginDate;
	}
	
	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getEndDate() {
		return endDate;
	}
	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}
	
	
	@Id
	@GeneratedValue
	@JsonIgnore
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	
	@Transient
	public Integer getYanbaoId() {
		return yanBao==null?null:yanBao.getId();
	}
	
	
	
}
